<template>
	<view class="con">
		<view class="title">养犬人信息</view>
		<view>
			养犬人姓名
			<text class="huang">※</text>
		</view>
		<input type="text" v-model="LegalPersonName" placeholder="请输入养犬人姓名" />
		<view>
			性别
			<text class="huang">※</text>
		</view>
		<radio-group @change="radioChangeLegalSex">
			<label class="radio">
				<radio value="0" checked="true" color="#fcd700" />
				男
			</label>
			<label class="radio">
				<radio value="1" color="#fcd700" />
				女
			</label>
		</radio-group>
		<view>
			身份证号
			<text class="huang">※</text>
		</view>
		<input type="text" v-model="identityNumber" placeholder="身份证号" />
		<view>
			手机号
			<text class="huang">※</text>
		</view>
		<input type="number" v-model="phoneNumber" placeholder="手机号" />
		<view>
			验证码
			<text class="huang">※</text>
		</view>
		<input type="number" style="width: 200upx;" v-model="ma" placeholder="请输入验证码" />
		<button @tap="faMa" v-show="isFa" type="primary" style="font-size: 26upx;width: 200upx;height: 64upx;line-height:64upx;margin-top: -70upx;">发送验证码</button>
		<button v-show="!isFa" style="font-size: 26upx;width: 200upx;height: 64upx;line-height:64upx;margin-top: -70upx;"
		 disabled>{{ miao }}秒</button>

		<view>
			居（暂）住地
			<text class="huang">※</text>
		</view>
		<view class="" style="display: flex;">
			<!-- <view class="uni-input" style="color: #333333;">河北省</view> -->
			<picker mode="selector" id="SHI" :value="SHIindex" range-key="label" :range="SHI" @change="bindPickerChange">
				<view class="uni-input" v-show="!SHICode">请选择市</view>
				<view class="uni-input" v-show="SHICode">{{ SHI[SHIindex]['label'] }}</view>
			</picker>
			<picker v-if="xianShow" mode="selector" id="XIAN" :value="XIANindex" range-key="label" :range="XIAN" @change="bindPickerChange">
				<view class="uni-input" v-show="!XIANCode">请选择区</view>
				<view class="uni-input" v-show="XIANCode">{{ XIAN[XIANindex]['label'] }}</view>
			</picker>
		</view>

		<!-- <picker id="city" @change="bindPickerChange" :value="cityIndex" mode="region">
			<view class="uni-input">{{ city[0] }}，{{ city[1] }}，{{ city[2] }}</view>
		</picker> -->
		<picker id="JD" @change="bindPickerChange" :value="JDindex" range-key="label" :range="JD" v-if="jdShow">
			<view class="uni-input" v-show="!JDCode">请选择街道</view>
			<view class="uni-input" v-show="JDCode">{{ JD[JDindex]['label'] }}</view>
		</picker>
		<picker id="PCS" @change="bindPickerChange" :value="PCSindex" range-key="label" :range="PCS" v-if="pcsShow">
			<view class="uni-input" v-show="!PCSCode">请选择派出所</view>
			<view class="uni-input" v-show="PCSCode">{{ PCS[PCSindex]['label'] }}</view>
		</picker>
		<input type="text" v-model="address" style="height: 100upx;" placeholder="请输入详细地址" />
		<view class="title">紧急联系信息</view>
		<view>
			紧急联系人姓名
			<text class="huang">※</text>
		</view>
		<input type="text" v-model="contactName" placeholder="紧急联系人姓名" />
		<view>
			紧急联系人手机号
			<text class="huang">※</text>
		</view>
		<input type="number" v-model="ApplicantNumber" placeholder="请输入紧急联系人手机号" />
		<view class="title">犬只信息</view>
		<view>
			犬只名称
			<text class="huang">※</text>
		</view>
		<input type="text" v-model="dogName" placeholder="请输入犬只名称" />
		<view>
			犬只公母
			<text class="huang">※</text>
		</view>
		<radio-group @change="radioChangeDogSex">
			<label class="radio">
				<radio value="1" color="#fcd700" />
				公
			</label>
			<label class="radio">
				<radio value="0" color="#fcd700" />
				母
			</label>
		</radio-group>
		<view>
			犬只出生日期
			<text class="huang">※</text>
		</view>
		<picker id="CSdate" mode="date" :value="CSdate" :start="startDate" :end="endDate" @change="bindPickerChange">
			<view class="uni-input">{{ CSdate }}</view>
		</picker>
		<view>
			犬只品种
			<text class="huang">※</text>
		</view>
		<input type="text" v-model="variety" placeholder="请输入犬只品种" />
		<view>
			犬只身高（厘米）
			<text class="huang">※</text>
		</view>
		<input type="number" v-model="dogHight" placeholder="请输入犬只身高(厘米)" />
		<view>
			犬只体重（公斤）
			<text class="huang">※</text>
		</view>
		<input type="number" v-model="dogWeight" placeholder="请输入犬只体重(公斤)" />
		<view>
			犬只最后注射疫苗时间
			<text class="huang">※</text>
		</view>
		<picker id="ZSdate" mode="date" :value="ZSdate" :start="startDate" :end="endDate" @change="bindPickerChange">
			<view class="uni-input">{{ ZSdate }}</view>
		</picker>
		<view class="title">图片上传
			<!-- <br>
			(拍照上传失败时，请用本机相机拍照后从相册选取上传) -->
		</view>
		<view class="picBox" style="display: flex;flex-wrap: wrap;">

			<view>
				<text>
					免疫证封皮照片
					(封皮照片)
					<text class="huang">※</text>
				</text>
				<view class="uni-uploader">
					<view class="uni-uploader-body">
						<view class="uni-uploader__files">
							<block>
								<view v-show="imageList.mianyif" class="uni-uploader__file" style="position: relative;">
									<image class="uni-uploader__img" :src="imageList.mianyif"></image>
									<view class="close-view" @click="close('mianyif')">x</view>
								</view>
							</block>
							<view class="uni-uploader__input-box" v-show="!imageList.mianyif">
								<view class="uni-uploader__input" @tap="chooseImg('mianyif')"></view>

							</view>
						</view>
					</view>
				</view>
			</view>
			<view>
				<text>
					免疫证内页照片
					（显示注射日期）
					<text class="huang">※</text>
				</text>
				<view class="uni-uploader">
					<view class="uni-uploader-body">
						<view class="uni-uploader__files">
							<block>
								<view v-show="imageList.mianyi" class="uni-uploader__file" style="position: relative;">
									<image class="uni-uploader__img" :src="imageList.mianyi"></image>
									<view class="close-view" @click="close('mianyi')">x</view>
								</view>
							</block>
							<view class="uni-uploader__input-box" v-show="!imageList.mianyi">
								<view class="uni-uploader__input" @tap="chooseImg('mianyi')"></view>
							</view>
						</view>
					</view>
				</view>
			</view>

			<view>
				<text>
					户口本或居住证
					（显示犬主信息）
					<text class="huang">※</text>
				</text>
				<view class="uni-uploader">
					<view class="uni-uploader-body">
						<view class="uni-uploader__files">
							<block>
								<view v-show="imageList.hukouben" class="uni-uploader__file" style="position: relative;">
									<image class="uni-uploader__img" :src="imageList.hukouben"></image>
									<view class="close-view" @click="close('hukouben')">x</view>
								</view>
							</block>
							<view class="uni-uploader__input-box" v-show="!imageList.hukouben">
								<view class="uni-uploader__input" @tap="chooseImg('hukouben')"></view>
							</view>
						</view>
					</view>
				</view>
			</view>

			<view>
				<text>
					房本或租房合同
					（显示地址信息）
					<text class="huang">※</text>
				</text>
				<view class="uni-uploader">
					<view class="uni-uploader-body">
						<view class="uni-uploader__files">
							<block>
								<view v-show="imageList.fangben" class="uni-uploader__file" style="position: relative;">
									<image class="uni-uploader__img" :src="imageList.fangben"></image>
									<view class="close-view" @click="close('fangben')">x</view>
								</view>
							</block>
							<view class="uni-uploader__input-box" v-show="!imageList.fangben">
								<view class="uni-uploader__input" @tap="chooseImg('fangben')"></view>
							</view>
						</view>
					</view>
				</view>
			</view>

			<view>
				<text>
					犬只近期照片
					<text class="huang">※</text>
				</text>
				<view class="uni-uploader">
					<view class="uni-uploader-body">
						<view class="uni-uploader__files">
							<block>
								<view v-show="imageList.caizhao" class="uni-uploader__file" style="position: relative;">
									<image class="uni-uploader__img" :src="imageList.caizhao"></image>
									<view class="close-view" @click="close('caizhao')">x</view>
								</view>
							</block>
							<view class="uni-uploader__input-box" v-show="!imageList.caizhao">
								<!-- <view class="uni-uploader__input" @tap="chooseImg('caizhao')"></view> -->
								<avatar selWidth="287px" selHeight="324px" @upload="myUpload" :avatarSrc="imageList.caizhao" avatarStyle="width: 100%; height: 200upx;position:relative;z-index:2;background:none;">
								</avatar>
							</view>
						</view>
					</view>
				</view>
			</view>

			<view>
				<text>
					养犬人照片
					<text class="huang">※</text>
				</text>
				<view class="uni-uploader">
					<view class="uni-uploader-body">
						<view class="uni-uploader__files">
							<block>
								<view v-show="imageList.yqr" class="uni-uploader__file" style="position: relative;">
									<image class="uni-uploader__img" :src="imageList.yqr"></image>
									<view class="close-view" @click="close('yqr')">x</view>
								</view>
							</block>
							<view class="uni-uploader__input-box" v-show="!imageList.yqr">
								<view class="uni-uploader__input" @tap="chooseImg('yqr')"></view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view>
			待犬牌网上审核通过后，联系养犬系统服务中心
			<text class="huang">※</text>
		</view>
		<view style="display: flex;align-items: center;">
			<view v-if="!zsdShow">该地区没有办理犬牌、注射芯片地点</view>
			<picker style="flex: 1;margin-right: 20upx;" id="ZSD" @change="bindPickerChange" :value="ZSDindex" range-key="label"
			 :range="ZSD" v-if="zsdShow">
				<view class="uni-input">{{ ZSD[ZSDindex]['label'] }}</view>
			</picker>
			<button v-if="zsdShow" @tap="getxiangqing()" type="primary" size="mini">地点详情</button>
		</view>
		<view style="margin-bottom: 20upx;">
			<switch @change="switch1Change" />
			阅读并接受 <text @tap="showCns" style="color: #007AFF;padding-left: 20upx;">《承诺书》</text>
		</view>
		<view class="mark" v-show="isCns">
			<view class="guanbi_btn" @tap="showCns()">
				关闭
			</view>
			<image src="../../static/img/chengnuoshu.jpg" mode="aspectFit"></image>
		</view>
		<view class="" style="text-align: center;color: #888888;">
			<text>支付犬牌犬证费用，金额为 {{ money }} 元</text>
		</view>


		<view class="btn"><button type="default" style="background-color:#fcd700;" @click="submit">确认提交</button></view>
		<view class="wenzi">
			<navigator url="./weixian">禁养危险犬品种</navigator>
			<view class="">{{ nowTime }}</view>
		</view>
		<view @tap="isMask = !isMask" v-if="isMask" @touchmove.stop.prevent="isMask = !isMask" class="mask" style="display: flex;
						justify-content: center;
						align-items: center;
						position: fixed;top: 0;left: 0;
						height: 100%;width: 100%;
						background: rgba(0,0,0,.8);
						z-index: 9;">
			<view @tap.stop class="mask_box" style="width: 80%;
			background: #D9D9D9;border-radius: 10upx;padding: 10upx;line-height: 60upx;">
				<view>
					<text style="width: 200upx;display: inline-block;">办理点名称</text>
					<text style="color: #888888;">{{ banzhengdian.name }}</text>
				</view>
				<view>
					<text style="width: 200upx;display: inline-block;">地址</text>
					<text style="color: #888888;">{{ banzhengdian.address }}</text>
				</view>
				<view>
					<text style="width: 200upx;display: inline-block;">联系电话</text>
					<text style="color: #888888;">{{ banzhengdian.phone }}</text>
				</view>
				<view>
					<text style="width: 200upx;display: inline-block;">备注</text>
					<text style="color: #888888;">{{ banzhengdian.remark }}</text>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	import avatar from "../../components/yq-avatar/yq-avatar.vue";
	import CHONG from '../../static/js/function.js';
	import IdCard from '../../static/js/IdCard.js';
	export default {
		computed: {
			startDate() {
				return this.getDate('start');
			},
			endDate() {
				return this.getDate('end');
			},
			...mapState(['URL', 'TOKEN'])
		},
		data() {
			const currentDate = this.getDate({
				format: true
			});

			return {
				banzhengdian: {
					name: 'name',
					address: 'address',
					phone: 'phone',
					remark: 'text'
				},
				isMask: false,

				// cityIndex: [2, 0, 0],
				PCSindex: 0,
				JDindex: 0,
				ZSDindex: 0,
				SHIindex: 0,
				XIANindex: 1,

				// city: ['河北省', '石家庄市', '长安区'],
				SHI: [{
				  "label": "唐山市",
				  "value": "130200"
				}],
				XIAN: [{
				  "label": "路北区",
				  "value": "130203"
				},{
				  "label": "路北区",
				  "value": "130203"
				}],
				PCS: [],
				JD: [],
				CSdate: '请选择犬只出生日期',
				ZSdate: '请选择犬只最后注射疫苗时间',
				ZSD: [],

				LegalPersonName: '', //法人姓名
				legalSex: '0', //法人性别
				identityNumber: '', //法人身份证号
				phoneNumber: '', //手机号
				ma: '',

				// cityCode: '130102',
				SHICode: '',
				XIANCode: '',
				JDCode: '',
				PCSCode: '',

				address: '', //详细地址
				contactName: '', //申请人姓名
				ApplicantNumber: '', //申请人身份证号
				dogName: '', //狗狗名字
				dogSex: '', //狗狗性别
				dogAgeValue: '请选择犬只出生日期', //狗狗年龄
				variety: '', //狗狗品种
				dogHight: '', //狗狗身高
				dogWeight: '', //狗狗体重
				lastDate: '请选择犬只最后注射疫苗时间', //最后疫苗注射时间
				imageList: {
					//狗狗 图片
					mianyi: '', //免疫证正面照片
					mianyif: '', //免疫证反面照片
					hukouben: '', //户口本
					fangben: '', //房本
					caizhao: '',
					yqr: '' //彩照
				},
				imgsData: {
					mianyi: '', //免疫证正面
					mianyif: '', //免疫证反面
					hukouben: '', //户口本
					fangben: '', //房本
					caizhao: '',
					yqr: '' //彩照
				},
				ZSDCode: '', //注射点

				isFa: true,
				miao: 59,
				bizId: '',

				xianShow: false,
				pcsShow: false,
				jdShow: false,
				zsdShow: false,
				isShow: true,
				imgIndex: 0,

				money: ' ',
				// consumerHotline: '156-1789-3256', //客服电话
				nowTime: new Date(), //登记日期
				isCns: false,
				isTongyi: false
			};
		},
		methods: {
			...mapMutations(['TO_UPDATE']),
			getxiangqing() {
				uni.request({
					url: this.URL + 'bzdDetail',
					data: {
						id: this.ZSDCode
					},
					success: res => {
						console.log(res.data.data[0]);
						this.banzhengdian = res.data.data[0];
						this.isMask = !this.isMask;
					}
				});
			},
			myUpload(rsp) {
				this.imageList.caizhao = rsp.path;
			},
			showCns() {
				this.isCns = !this.isCns;
			},
			switch1Change: function(e) {
				this.isTongyi = e.target.value;
				console.log('switch1 发生 change 事件，携带值为', e.target.value)
			},
			faMa() {
				if (!this.phoneNumber) {
					CHONG.tip('请填写手机号');
					return;
				}
				if (this.phoneNumber.length !== 11) {
					CHONG.tip('手机号格式不正确，请重新填写');
					return;
				}
				this.isFa = false;
				let timer = setInterval(() => {
					this.miao--;
					if (this.miao === 0) {
						clearInterval(timer);
						this.isFa = true;
						this.miao = 59;
					}
				}, 1000);
				uni.request({
					url: this.URL + 'Sendchecked',
					data: {
						telephone: this.phoneNumber
					},
					success: res => {
						console.log('返回的验证码');
						console.log(res.data);
						if (res.data.success) {
							this.bizId = res.data.data[0].bizId;
						} else {
							CHONG.tip('网路错误，请稍后再试');
						}
					}
				});
			},
			bindPickerChange(e) {
				console.log(e);
				// 			if (e.currentTarget.id === 'city') {
				// 				this.city = e.target.value;
				// 				this.cityCode = e.target.code[2];
				//
				// 				this.getPaichusuo(e.target.code[2]);
				// 				this.getJeidao(e.target.code[2]);
				// 				this.getZhushedian(e.target.code[2]);
				// 			} else
				if (e.currentTarget.id === 'SHI') {
					this.SHIindex = e.target.value;
					this.SHICode = this.SHI[this.SHIindex]['value'];
					this.XIAN = [];
					this.XIANCode = "";
					this.XIANindex = 1;

					this.JD = [];
					this.JDCode = "";
					this.JDindex = 0;

					this.PCS = [];
					this.PCSCode = "";
					this.PCSindex = 0;

					this.ZSD = [];
					this.ZSDCode = "";
					this.ZSDindex = 0;
					this.getXian(this.SHICode);
				} else if (e.currentTarget.id === 'XIAN') {
					this.JD = [];
					this.JDCode = "";
					this.JDindex = 0;

					this.PCS = [];
					this.PCSCode = "";
					this.PCSindex = 0;

					this.ZSD = [];
					this.ZSDCode = "";
					this.ZSDindex = 0;

					this.XIANindex = e.target.value;
					this.XIANCode = this.XIAN[this.XIANindex]['value'];
					this.getPaichusuo(this.XIANCode);
					this.getJeidao(this.XIANCode);
					this.getZhushedian(this.XIANCode);
				} else if (e.currentTarget.id === 'PCS') {
					this.PCSindex = e.target.value;
					this.PCSCode = this.PCS[this.PCSindex]['value'];
				} else if (e.currentTarget.id === 'JD') {
					this.JDindex = e.target.value;
					this.JDCode = this.JD[this.JDindex]['value'];
				} else if (e.currentTarget.id === 'CSdate') {
					this.dogAgeValue = this.CSdate = e.target.value;
				} else if (e.currentTarget.id === 'ZSdate') {
					this.lastDate = this.ZSdate = e.target.value;
				} else if (e.currentTarget.id === 'ZSD') {
					this.ZSDindex = e.target.value;
					this.ZSDCode = this.ZSD[this.ZSDindex]['value'];
				}
			},
			getShi() {
				uni.request({
					url: this.URL + 'shi',
					success: res => {
						// console.log("shi");
						// console.log(res.data);
						if (res.data.success) {
							this.SHI = res.data.data;
							this.getXian(this.SHI[0]['value']);
							// this.SHICode = this.SHI[0]['value'];
							this.xianShow = true;
							// console.log(this.SHICode);
						}
					}
				});
			},
			getXian(code) {
				uni.request({
					url: this.URL + 'xian',
					data: {
						code: code
					},
					success: res => {
						console.log("xian");
						console.log(res.data);
						if (res.data.success) {
							this.XIAN = res.data.data;
							// this.XIANCode = this.XIAN[1]['value'];
							this.getPaichusuo(this.XIANCode);
							this.getJeidao(this.XIANCode);
							this.getZhushedian(this.XIANCode);
						}
					}
				});
			},
			getPaichusuo(code) {
				uni.request({
					url: this.URL + 'police',
					data: {
						code: code
					},
					success: res => {
						if (res.data.success) {
							this.PCS = res.data.data;
							this.pcsShow = true;
							// this.PCSCode = this.PCS[this.PCSindex]['value'];
							// } else {
							// 	CHONG.tip("该地区没有派出所，请重新选择");
							// 	this.pcsShow = false;
							// 	this.PCSCode = '';
						}
					}
				});
			},
			getZhushedian(code) {
				uni.request({
					url: this.URL + 'bzd',
					data: {
						code: code
					},
					success: res => {
						if (res.data.data.length > 0) {
							this.ZSD = res.data.data;
							this.zsdShow = true;
							this.ZSDCode = this.ZSD[this.ZSDindex]['value'];
							// } else {
							// 	CHONG.tip('该地区没有注射点，请重新选择');
							// 	this.zsdShow = false;
							// 	this.ZSDCode = '';
						}
						console.log(res.data);
					}
				});
			},
			getJeidao(code) {
				uni.request({
					url: this.URL + 'jie',
					data: {
						code: code
					},
					success: res => {
						if (!res.data.success) {
							// CHONG.tip("该地区没有街道，请重新选择");
							this.jdShow = false;
							this.JDCode = '';
						} else {
							this.JD = res.data.data;
							this.jdShow = true;
							// this.JDCode = this.JD[this.JDindex]['value'];
						}
					}
				});
			},
			getMoney() {
				uni.request({
					url: this.URL + 'cost',
					success: res => {
						this.money = res.data.data[0].money;
					}
				});
			},
			postGenren() {
				CHONG.tip('信息上传中', 0);
				this.imgIndex = 0;
				let data = {
					wxid: this.TOKEN,
					atype: '0',

					name: this.LegalPersonName,
					sex: this.legalSex,
					useridno: this.identityNumber, //法人身份证号
					phone: this.phoneNumber, //法人手机号
					code: this.JDCode || this.XIANCode,
					pcode: this.PCSCode,
					address: this.address,
					contactName: this.contactName, //申请人姓名
					ApplicantNumber: this.ApplicantNumber, //申请人手机号
					dog_Name: this.dogName,
					dog_Sex: this.dogSex,
					dog_Age: this.dogAgeValue,
					retriever: this.variety,
					dog_Height: this.dogHight,
					dog_Weight: this.dogWeight,
					immuneTime: this.lastDate,
					injectionLocation: this.ZSDCode,
					immune_Pic: this.imgsData.mianyi,
					immune_Picf: this.imgsData.mianyif,
					registerpic: this.imgsData.hukouben,
					propertypic: this.imgsData.fangben,
					dog_Avatar: this.imgsData.caizhao,
					avatar: this.imgsData.yqr
				};

				console.log(data);
				uni.request({
					url: this.URL + 'addManage',
					data: data,
					success: res => {
						uni.hideLoading();
						console.log(res.data);

						if (res.data.code === '200') {
							this.TO_UPDATE(true);
							setTimeout(() => {
								uni.navigateBack();
							}, 1500);
						}
						CHONG.tip(res.data.msg); //单位
					},
					fail: res => {
						console.log(res.data);
					}
				});
			},
			postTUpian(key) {

				uni.uploadFile({
					url: this.URL + 'uploadManage',
					filePath: this.imageList[key],
					name: key,
					success: res => {
						let json = JSON.parse(res.data);
						if (json.data[0].status) {
							this.imgsData[key] = this.imgIndex;
							this.imgsData[key] = json.data[0].fileName;
							this.imgIndex++;
							console.log(this.imgIndex);
							if (this.imgIndex === 6) {
								this.postGenren();
								console.log(1111111111111111111);
							}
							return;
						} else {
							CHONG.tip(json.data[0].msg, 1);
						}
					}
				});
			}, //表信息 提交
			submit() {
				console.log(`发送`);
				// CHONG.tip('信息提交中', 0);
				CHONG.tip('信息效验中', 0);

				this.validation();
			},
			//效验
			validation() {
				// let idcardReg =
				// 	/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
				if (!this.LegalPersonName) {
					CHONG.tip('请填写养犬人姓名', 1);
					return;
				} else if (!this.identityNumber) {
					CHONG.tip('请填写养犬人身份证号', 1);
					return;
				} else if (IdCard.cnid(this.identityNumber) !== true) {
					CHONG.tip('请填写正确格式的养犬人身份证号', 1);
					return;
				} else if (!this.phoneNumber) {
					CHONG.tip('请填写养犬人手机号', 1);
					return;
				} else if (this.phoneNumber.length !== 11 && this.phoneNumber.length !== 13) {
					CHONG.tip('请填写正确格式的养犬人手机号', 1);
					return;
				} else if (!this.ma) {
					CHONG.tip('请输入验证码');
					return;
				} else if (this.ma.length !== 4) {
					CHONG.tip('验证码不正确');
					return;
				} else if (!this.SHICode) {
					CHONG.tip('请选择市', 1);
					return;
				} else if (!this.XIANCode) {
					CHONG.tip('请选择区', 1);
					return;
				} else if (this.JD.length!==0&&!this.JDCode) {
					console.log(this.JD);
					CHONG.tip('请选择街道', 1);
					return;
				} else if (!this.PCSCode) {
					CHONG.tip('请选择派出所', 1);
					return;
				} else if (!this.address) {
					CHONG.tip('请填写详细地址', 1);
					return;
				} else if (!this.contactName) {
					CHONG.tip('请填写紧急联系人姓名', 1);
					return;
				} else if (!this.ApplicantNumber) {
					CHONG.tip('请填写紧急联系人手机号', 1);
					return;
				} else if (this.ApplicantNumber.length !== 11 && this.phoneNumber.length !== 13) {
					CHONG.tip('请填写正确格式的紧急联系人手机号', 1);
					return;
				} else if (!this.dogName) {
					CHONG.tip('请填写犬只名称', 1);
					return;
				} else if (!this.dogSex) {
					CHONG.tip('请选择犬只公母', 1);
					return;
				} else if (this.dogAgeValue === '请选择犬只出生日期') {
					CHONG.tip('请选择犬只出生日期', 1);
					return;
				} else if (!this.variety) {
					CHONG.tip('请填写犬只品种', 1);
					return;
				} else if (!this.dogHight) {
					CHONG.tip('请填写犬只身高', 1);
					return;
				} else if (!this.dogWeight) {
					CHONG.tip('请填写犬只体重', 1);
					return;
				} else if (this.lastDate === '请选择犬只最后注射疫苗时间') {
					CHONG.tip('请选择犬只最后注射疫苗时间', 1);
					return;
				} else if (!this.imageList.mianyi) {
					CHONG.tip('请上传免疫证封皮照片', 1);
					return;
				} else if (!this.imageList.mianyif) {
					CHONG.tip('请上传免疫证内页照片', 1);
					return;
				} else if (!this.imageList.hukouben) {
					CHONG.tip('请上传户口本照片', 1);
					return;
				} else if (!this.imageList.fangben) {
					CHONG.tip('请上传房本照片', 1);
					return;
				} else if (!this.imageList.caizhao) {
					CHONG.tip('请上传犬只近期照片', 1);
					return;
				} else if (!this.imageList.yqr) {
					CHONG.tip('请上传养犬人照片', 1);
					return;
				} else if (!this.ZSDCode) {
					CHONG.tip('请选择办理犬牌，注射芯片地点', 1);
					return;
				} else if (!this.isTongyi) {
					CHONG.tip('请阅读并接受承诺书', 1);
					return;
				}

				if (this.ma.length === 4) {
					CHONG.tip('验证码效验中', 0);

					uni.request({
						url: this.URL + 'Msgchecked',
						data: {
							bizId: this.bizId,
							telephone: this.phoneNumber,
							checkNo: this.ma
						},
						success: res => {
							console.log('提交验证码了');
							console.log(res.data);
							if (res.data.success) {
								this.postTUpian('mianyi');
								this.postTUpian('mianyif');
								this.postTUpian('hukouben');
								this.postTUpian('fangben');
								this.postTUpian('caizhao');
								this.postTUpian('yqr');
							} else {
								CHONG.tip('验证码不正确');
							}
						}
					});
				}
			},
			radioChangeLegalSex(e) {
				this.legalSex = e.detail.value;
				console.log(this.legalSex);
			},
			radioChangeDogSex(e) {
				this.dogSex = e.detail.value;
			},
			chooseImg(q) {
				//选择图片
				uni.chooseImage({
					sourceType: ['album', 'camera'],
					sizeType: ['compressed'],
					count: 1,
					success: res => {
						this.imageList[q] = res.tempFilePaths[0];
						console.log(res);

					}
				});
			},
			close(e) {
				this.imageList[e] = '';
			},
			getDate(type) {
				const date = new Date();
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();

				if (type === 'start') {
					year = year - 60;
				} else if (type === 'end') {
					year = year + 2;
				}
				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			}
		},
		mounted() {
			this.getShi();
			// this.getJeidao(this.cityCode);
			// this.getPaichusuo(this.cityCode);
			// this.getZhushedian(this.cityCode);
			this.getMoney();

		},
		components: {
			avatar
		}
	};
</script>

<style lang="scss">
	// .content {
		.con {
			font-size: 26upx;
			// .unit {
			padding: 20upx;
	
			.title {
				text-align: center;
				font-size: 28upx;
				font-weight: 700;
				margin-bottom: 20upx;
				padding-top: 50upx;
			}
	
			input {
				color: $chong-text-color;
				font-size: 24upx;
				margin: 10upx 0;
				padding: 4upx 20upx;
	
				border: {
					radius: 10upx;
					style: solid;
					width: 1upx;
					color: rgba($chong-text-color, 0.2);
				}
	
				background: white;
			}
	
			radio-group {
				padding: 20upx 0;
	
				label {
					.uni-radio-input-checked {
						background-color: $chong-iconbg-color !important;
					}
	
					padding: 0 10upx;
				}
			}
	
			/* 上传 */
			.uni-uploader {
				flex: 1;
				flex-direction: column;
				width: 100%;
			}
	
			.uni-uploader-info {
				color: #b2b2b2;
			}
	
			.uni-uploader-body {
				margin-top: 16upx;
			}
	
			.uni-uploader__files {
				display: flex;
				flex-direction: row;
				flex-wrap: wrap;
			}
	
			.uni-uploader__file {
				width: 208upx;
				height: 208upx;
				margin: 10px auto;
			}
	
			.uni-uploader__img {
				display: block;
				width: 208upx;
				height: 208upx;
			}
	
			.uni-uploader__input-box {
				position: relative;
				margin: 10upx auto;
				width: 208upx;
				height: 208upx;
				border: 2upx solid #d9d9d9;
			}
	
			.uni-uploader__input-box:before,
			.uni-uploader__input-box:after {
				content: ' ';
				position: absolute;
				top: 50%;
				left: 50%;
				-webkit-transform: translate(-50%, -50%);
				transform: translate(-50%, -50%);
				background-color: #d9d9d9;
			}
	
			.uni-uploader__input-box:before {
				width: 4upx;
				height: 79upx;
			}
	
			.uni-uploader__input-box:after {
				width: 79upx;
				height: 4upx;
			}
	
			.uni-uploader__input-box:active {
				border-color: #999999;
			}
	
			.uni-uploader__input-box:active:before,
			.uni-uploader__input-box:active:after {
				background-color: #999999;
			}
	
			.uni-uploader__input {
				position: absolute;
				z-index: 1;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				opacity: 0;
			}
	
			.uni-uploader__file,
			.uni-uploader__input-box {
				width: 50%;
			}
	
			.close-view {
				text-align: center;
				line-height: 14px;
				height: 16px;
				width: 16px;
				border-radius: 50%;
				background: #ff5053;
				color: #ffffff;
				position: absolute;
				top: -6px;
				right: -4px;
				font-size: 12px;
			}
	
			.picBox > view {
				width: 50%;
				display: flex;
				flex-direction: column;
				align-items: center;
			}
	
			// }
			// 		.personal {
			// 		}
		}
	
		.wenzi {
			margin: 40upx 0;
			line-height: 40upx;
			font-size: 16upx;
			text-align: center;
			color: #888888;
		}
	
		.btn {
			padding: 50upx 0;
			margin: 0 140upx;
		}
	// }
	
	.huang {
		color: $chong-iconbg-color;
	}
	.uni-input {
		color: $chong-text-color;
		font-size: 24upx;
		margin: 10upx 0;
		padding: 17upx 20upx;

		border: {
			radius: 10upx;
			style: solid;
			width: 1upx;
			color: rgba($chong-text-color, 0.2);
		}

		background: white;
	}

	.mark {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		position: fixed;
		top: 0;
		left: 0;
		height: 100%;
		width: 100%;
		background: rgba(0, 0, 0, .8);
		z-index: 9;

		.guanbi_btn {
			margin-bottom: 50upx;
			background: #000000;
			color: #F8F8F8;
			padding: 10upx 20upx;
			border-radius: 30%;
		}

		image {
			width: 750upx;
			height: 950upx;
			background: none;
		}
	}
</style>
